package org.nch.videoLauncher.presenter;

import org.nch.videoLauncher.view.IBrowseVideoView;
import org.nch.videoLauncher.view.VideoDetailsView;
import org.nch.videoLauncher.task.VideoItemTask;
import org.nch.videoLauncher.domain.VideoItem;

import java.util.List;
import java.util.Collections;

/**
 * Created by IntelliJ IDEA.
 * User: bill
 * Date: Nov 19, 2008
 * Time: 2:31:56 PM
 * To change this template use File | Settings | File Templates.
 */
public class BrowseVideoPresenter {

    private IBrowseVideoView view;
    private MainWindowPresenter mainWindowPresenter;
    private VideoItemTask task;
    private List<VideoItem> videoItems;
    private VideoDetailsView videoDetailsView;

    public BrowseVideoPresenter(IBrowseVideoView browseVideoView, MainWindowPresenter mwp){
        this.view = browseVideoView;
        this.mainWindowPresenter = mwp;
        this.task = new VideoItemTask();
        this.videoItems = task.getAllVideoItems();
        view.setMovieList(task.getAllMovies());
        view.setTvShowList(task.getAllTvShows());
        view.setSportsEventList(task.getAllSportsEvents());
        view.showVideoListData();
        mainWindowPresenter.setMainWindowMessageText("Select a video then click on 'Play Video' to start the video.");
    }

    public void showDetailsView(VideoItem videoItem) {

        videoDetailsView = null;
        videoDetailsView = new VideoDetailsView();
        VideoDetailsPresenter detailsPresenter = new VideoDetailsPresenter(videoDetailsView, videoItem);
        videoDetailsView.setPresenter(detailsPresenter);
        view.showDetailsView(videoDetailsView);
    }    

}
